package top.lishuoboy.hibernate.validator.a2_3;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import lombok.experimental.SuperBuilder;
import org.hibernate.validator.constraints.CodePointLength;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;
import java.time.LocalDateTime;

/**
 * @author lishuoboy
 * 2024.10.16 21:42
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@Accessors(chain = true)
public class User {
    //    @Null
    @NotNull
    private Object objNullNotNull = 1;

    @AssertFalse
    @AssertTrue
    private Boolean boolFalseTrue;

    @Digits(integer = 1, fraction = 1)
    @DecimalMin(value = "-1.1", inclusive = false)
    @DecimalMax("1.1")
    @Min(-1)
    @Max(1)
    @Negative
    @Positive
    @NegativeOrZero
    @PositiveOrZero
    @Range(min = -1, max = 1)               //(属于hibernate)
    private Number numberMinMax;

    @Past
    @Future
    @PastOrPresent
    @FutureOrPresent
    private LocalDateTime timePastFuture;

    @NotBlank
    @Pattern(regexp = "\\w+@\\w+\\.\\w+", flags = {Pattern.Flag.MULTILINE, Pattern.Flag.CASE_INSENSITIVE})
    @Email
    @NotEmpty
    @Size(min = 1, max = 50)
    @Length(min = 1, max = 50)              //属于hibernate
    @CodePointLength(min = 1, max = 50)     //属于hibernate
    @URL                                    //属于hibernate
    private CharSequence charSeqPatternLength = "lishuoboy@qq.com";

    @NotEmpty
    @Size(min = 1, max = 3)
    private int[] collSize = {1, 2, 3};
}
